package com.hollysys.hollimsa.biz.istio.gateway.domain;

import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.util.Map;

/**
 * @author Administrator
 */
@Data
public class GatewayDTO implements Serializable {
    private static final long serialVersionUID = -3256503153090399427L;
    /** 网关名称 */
    @ApiModelProperty(value = "网关名称",required = true)
    private String name;

    @ApiModelProperty(value = "服务器规格列表",required = true)
    private InnerServer[] servers;

    @ApiModelProperty(value = "一个或多个标签，指示应在其上应用此网关配置的一组特定的Pod,==出口==",required = true)
    private Map<String, String> selector;

    @Data
    public static class InnerServer implements Serializable{
        private static final long serialVersionUID = -5631269612146328020L;
        /** 域名信息 */
        @ApiModelProperty(value = "域名信息",required = true)
        private String[] hosts;
        @ApiModelProperty(value = "代理应在其上侦听传入连接的端口。",required = true)
        private InnerPort port;
    }

    @Data
    @NoArgsConstructor
    @AllArgsConstructor
    @Builder
    public static class InnerPort implements Serializable{
        private static final long serialVersionUID = -551953731364620417L;
        @ApiModelProperty(value = "有效的非负整数端口号",required = true)
        private Integer number;
        @ApiModelProperty(value = "该协议在端口上公开。必须是HTTP | HTTPS | GRPC | HTTP2 | MONGO | TCP | TLS之一",required = true)
        private String protocol;
        @ApiModelProperty(value = "分配给端口的标签",required = true)
        private String name;
    }
}
